ComponentOne Studio Web API Edition
Aggregated Data

This section demonstrates how to call the Web API service through a client application and fetch the aggregated data for the sales of the products in the countries. The client sends a POST Ajax request to the service, which returns a response stream. The response stream is then saved in the JSON format.

In the following example, we use “complex” as an example. It is the registered key for the DataEngine data source. The service URL takes in the Data Source name, location of dataset or collection, and the corresponding fields that are associated with the dataset.

Call the Service

Use the following javascript to call the Web API service to create an analysis from the service application.

<script>
$.ajax({

      type: 'POST',

      url: 'http://server/api/dataengine/complex/analyses',

      data: {

        view: '{"fields":[{"binding":"Active","dataType":3},{"binding":"Country","dataType":1},{"binding":"Date","dataType":4},

        {
          "binding": "Discount",
          "dataType": 2
        },
        {
          "binding": "Downloads",
          "dataType": 2
        },
        {
          "binding": "ID",
          "dataType": 2
        },

        {
          "binding": "Product",
          "dataType": 1
        },
        {
          "binding": "Sales",
          "dataType": 2
        }],

      rowFields: {
        items: ["Product"]
      },

      columnFields: {
        items: ["Country"]
      },

      valueFields: {
        items: ["Sales"]
      }
    }
    '

  },

  dataType: 'json',

  cache: false,

  processData: false,

  success: function(data, status, xhr) {

    // the following information will be obtained from data.

    /*{

    "data": {

    "token":"93f00724-3877-41ea-80ff-bbeae96f5e36",

    "status":{

    “executingStatus”: ”Executing”,

    “progress”: // the analysis progress

    },

    “result”: //the result data,

    }

    }*/

  }

});
</script>                                                   
Back to Top

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback